/*
 * jlb
 */
package com.jlb.active.dao;

import com.jlb.active.entity.ActiveRecord;
import com.jlb.active.entity.ActiveRecordState;
import com.jlb.core.base.BaseDAO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 激活币使用记录
 *
 * @author jlb
 */
@Mapper
@Repository
public interface ActiveRecordDAO extends BaseDAO<ActiveRecord, Long> {

    /**
     * 加载一个对象ActiveRecord 通过id
     *
     * @param id
     * @return User
     */
    ActiveRecord loadById(@Param("id") java.lang.Long id);

    /**
     * 根据主键id,oldStates 共同更新 ActiveRecord 的状态到newState状态
     *
     * @param id
     * @param newState  新状态
     * @param oldStates 旧状态集合
     */
    void updateStateById(@Param("id") java.lang.Long id, @Param("updateTime") Date updateTime, @Param("newState") ActiveRecordState newState, @Param("oldStates") ActiveRecordState... oldStates);

    /**
     * 根据主键id 更新 ActiveRecord 的状态到另一个状态
     *
     * @param id
     * @param state 状态
     */
    void updateById(@Param("id") java.lang.Long id, @Param("state") ActiveRecordState state, @Param("updateTime") Date updateTime);

    /**
     * 删除对象ActiveRecord
     *
     * @param params 实体的属性
     */
    void delete(Map<String, Object> params);


    /**
     * 查询ActiveRecord列表
     *
     * @param rowBounds 分页参数
     * @return List<ActiveRecord>
     */
    List<ActiveRecord> list(RowBounds rowBounds);


    /**
     * 查询ActiveRecord分页 根据状态
     *
     * @param id
     * @return List<ActiveRecord>
     */
    List<ActiveRecord> listByPk(java.lang.Long id, ActiveRecordState state, RowBounds rowBounds);

    int countByPk(java.lang.Long id, ActiveRecordState state);
}
